package com.android.stockme.backend.portfolio;

import java.lang.Float;


import java.lang.String;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

import com.android.stockme.backend.util.Tupple;


public interface IStockProtfolio {


	/**
	 * Returns the last stock value fetched
     * @param symbol - 
	 * 			stock's {@code String} symbol
	 * @return returns the last stock value fetched as {@code float}
	 */
	public abstract float getStockValue(String symbol);


	
	
	/**
	 * Returns the last stock relative change (%) fetched
     * @param symbol - 
	 * 			stock's {@code String} symbol
	 * @return returns the last stock relative change (%) fetched as {@code float}
	 */
	public abstract float getStockRelativeChange(String symbol);
				


	
	/**
	 * Update the portfolio with new stocks' values and new relative change values
	 * The method will also post, to its listeners, an event about the change 
	 * @param data - 
	 * 				{@code Map<String , Tupple<Float,Float> >} with stocks 
	 * symbols as {@code Map} keys and Tupple containing current stock value and 
	 * relative change as {@code Map} values
	 */
	public abstract void updatePortfolio(Map<String,Tupple<Float,Float>> data);
	


	
	
	/**
	 * Update a specific stock with new value and new relative change value
	 * @param symbol - 
	 * 				stock's {@code String} symbol
	 * @param valueAndChange - 
	 * 				{@code Tupple<Float, Float>} containing current stock value and 
	 * relative change
	 */
	public abstract void updateStockData(String symbol, Tupple<Float, Float> valueAndChange);
	
	


	
	/**
	 * Update a specific stock with new value and new relative change value
	 * @param symbol - 
	 * 				stock's {@code String} symbol
	 * @param value - 
	 * 				current stock's value
	 * @param change - 
	 * 				current stock's relative change
	 * relative change
	 */
	public abstract void updateStockData(String symbol, Float value , Float change); 
				

	
	
	/**
	 * Add a new stock to the portfolio
     * At beginning, value and relative change is 0.0
	 * @param symbol -
	 * 			stock's {@code String} symbol represents the new stock to add
	 * @return
	 */	
	public abstract void addStock(String symbol); 	

	
	
	
	/**
	 * Add a new stocks to the portfolio
     * At beginning, value and relative change of all new stocks is 0.0
	 * @param symbols -
	 * 			{@code Collection<String>} represents the new stocks to add
	 * @return
	 */	
	public abstract void addStocks(Collection<String> symbols);
	

	
	/**
	 * Add new listener for "stock portfolio updated" event
	 * @param listener -
	 * 			 listener to be added for "stock portfolio updated" event
	 * @return
	 */	
	public abstract void registerStockPortfolioUpdatedListener(IStockPortfolioUpdatedListener listener);
						


	
	
	/**
	 * Remove listener for "stock portfolio updated" event
	 * @param listener -
	 * 			 listener to be removed for "stock portfolio updated" event
	 * @return
	 */	
	public abstract void unregisterStockPortfolioUpdatedListener(IStockPortfolioUpdatedListener listener);
	
	
	
	
	
	/**
	 * Returns the current amount of stocks in the portfolio
     * @param
	 * @return returns the current amount of stocks in the portfolio as {@code int}
	 */
	public abstract int getPortfolioSize();
	
	
	
	
	/**
	 * Returns a specific stock as a new object
     * @param symbol - 
	 * 			stock's {@code String} symbol
	 * @return returns a specific stock object as cloned {@code IStockData}
	 */
	public abstract IStockData getStockData(String symbol);
	
	
	
	
	/**
	 * Returns all stocks as new object
	 * @return returns all stocks as an {@code ArrayList} 
	 * containing cloned {@code IStockData} objects
	 */
	public abstract ArrayList<IStockData> getStocks();
	
	
	
    /**
     * Set all stocks' value and relative change to be zeroes
	 * @param
     * @return
     */
	public abstract void setZerous();
	
	
	
	
	/**
	 * 
	 * @return returns Runnable
	 */
	public abstract Runnable getProtfolioUpdateRunnable();


}
